package com.jxc.jxc01.hch.entity;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

public class PageHelper<E> implements Serializable {
    /**当前页码*/
    private int pageNum;
    /**页容*/
    private int pageSize;
    /**当前页数据*/
    private List<E> data;
    /**总记录数*/
    private int total;
    /**总页数*/
    private int pageCount;

    public PageHelper() {
    }

    public PageHelper(int pageNum, int pageSize, List<E> data, int total, int pageCount) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.data = data;
        this.total = total;
        this.pageCount = pageCount;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public List<E> getData() {
        return data;
    }

    public void setData(List<E> data) {
        this.data = data;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PageHelper<?> that = (PageHelper<?>) o;
        return pageNum == that.pageNum && pageSize == that.pageSize && total == that.total && pageCount == that.pageCount && Objects.equals(data, that.data);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pageNum, pageSize, data, total, pageCount);
    }

    @Override
    public String toString() {
        return "PageHelper{" +
                "pageNum=" + pageNum +
                ", pageSize=" + pageSize +
                ", data=" + data +
                ", total=" + total +
                ", pageCount=" + pageCount +
                '}';
    }
}
